﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright company="DHGMS Solutions" file="Base.cs">
//   2004-2012 DHGMS Solutions. Some Rights Reserved. Licensed under GNU General Public License version 2 (GPLv2)
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Dhgms.TplHelper.Model.Provider.Job
{
    using System;

    using Dhgms.DataManager.Model.Provider;

    /// <summary>
    /// Base provider for Tasks
    /// Used for handling how IO's are handled
    /// Allows for the IO's to be changed without recoding the core program on a per-program basis
    /// </summary>
    /// <typeparam name="TJobResultClass">
    /// </typeparam>
    public abstract class Base<TJobResultClass> : Base
        where TJobResultClass : Info.JobResult.Base, new()
    {
        #region Public Methods and Operators

        /// <summary>
        /// Handles sending of error information to different mediums
        /// </summary>
        /// <param name="jobGuid">
        /// Unique GUID used to identify job
        /// </param>
        /// <param name="jobName">
        /// Friendly name of job
        /// </param>
        /// <param name="e">
        /// Exception message
        /// </param>
        public abstract void OnJobFailure(Guid jobGuid, string jobName, Exception e);

        /// <summary>
        /// Notify the provider of a job start
        /// </summary>
        /// <param name="jobGuid">
        /// Unique ID of the job
        /// </param>
        public abstract void OnJobStart(Guid jobGuid);

        /// <summary>
        /// The on job sucess.
        /// </summary>
        /// <param name="jobGuid">
        /// Unique GUID used to identify program
        /// </param>
        /// <param name="jobName">
        /// Friendly name of program
        /// </param>
        /// <param name="taskResult">
        /// Run results of task
        /// </param>
        public abstract void OnJobSucess(Guid jobGuid, string jobName, TJobResultClass taskResult);

        /// <summary>
        /// Handles the sending of a task failure notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        /// <param name="e">
        /// Exception message
        /// </param>
        public abstract void OnTaskFailure(Guid taskGuid, Exception e);

        /// <summary>
        /// Handles the sending of a task start notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        public abstract void OnTaskStart(Guid taskGuid);

        /// <summary>
        /// Handles the sending of a task completion notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        public abstract void OnTaskSucess(Guid taskGuid);

        #endregion
    }
}